# -*- coding:utf-8 -*-
"""
Author：Administrator
Date:2022年01月22日
"""
import requests
from lxml import etree
from hashlib import md5
from chaojiying import Chaojiying_Client

网址='https://so.gushiwen.cn/user/login.aspx?from=http://so.gushiwen.cn/user/collect.aspx'
UA伪装={"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36"}
响应数据=requests.get(url=网址,headers=UA伪装).text
解析=etree.HTML(响应数据)

图片地址="https://so.gushiwen.cn"+解析.xpath('//*[@id="imgCode"]/@src')[0]
图片数据=requests.get(url=图片地址,headers=UA伪装).content
with open('./a.jpg','wb') as f:
	f.write(图片数据)

img = open('./a.jpg','rb').read()
chaojiying = Chaojiying_Client('18017735129', '19860324huli', '927570')
验证码 = chaojiying.PostPic(img, 1902)['pic_str']
print(验证码)


